/********************************************************************
filename : wolf_board_test.c
discript : This file offer board test function.
version  : V0.0
editor   : Icy - dreamwolf
time     : 2014.9.2
statement: This file is modified by dreamwolf under LGPL,you could use 
           it free.We cann't ensure there is no error in this file,and
				   if you detect an error please contact us freely,it is so a-
					 ppreciate for your help to improve our code that could help 
					 more people to use it safty.
contact  : edreamtek@163.com
           www.edreamtek.com
********************************************************************/

#include "wolf_board_test.h"



DesktopBackup		desktop_backup;
ADC_RESULT adc_result;
uint8_t i,goback=FALSE;




/********************************************************************
function: wolf_main_desktop(void)
discript: LCD desktop display main function,once enter this fuction,
					won't exit.
entrance: none
return  : none
time    : 2014.9.2
other   : none
********************************************************************/
void wolf_main_desktop(void)
{
	wolf_main_desktop_init();						//Init desktop display,state flag
	wolf_main_desktop_disp();						//Refresh display
}

/********************************************************************
function: wolf_main_desktop_init(void)
discript: Init desktop display,state flag
entrance: none
return  : none
time    : 2014.9.2
other   : none
********************************************************************/
void wolf_main_desktop_init(void)
{
	
	desktop_backup.height = LCD_HEIGHT;
	desktop_backup.width = LCD_WIDTH;
	desktop_backup.backup_color = GRAY;
	desktop_backup.state_bar_height = STATE_BAR_HEIGHT;
	desktop_backup.state_bar_color = BLUE;
	desktop_backup.H_icon_number = 2;
	desktop_backup.V_icon_number = 5;
	desktop_backup.refresh_flag = TRUE;
}

/********************************************************************
function: wolf_main_desktop_disp(void)
discript: refresh display
entrance: none
return  : none
time    : 2014.9.2
other   : none
********************************************************************/
void wolf_main_desktop_disp(void)
{
	wolf_main_desktop_backup();
}

/********************************************************************
function: wolf_main_desktop_backup(void)
discript: display desktop backup and frame
entrance: none
return  : none
time    : 2014.9.2
other   : none
********************************************************************/
void wolf_main_desktop_backup(void)
{
	if(desktop_backup.refresh_flag)
	{
		wolf_LCD9341_clear_screen(desktop_backup.backup_color);
		wolf_LCD9341_fill(0, desktop_backup.height-desktop_backup.state_bar_height-1,desktop_backup.width-1, desktop_backup.height-1, desktop_backup.state_bar_color);
		desktop_backup.refresh_flag = FALSE;
	}
	wolf_main_desktop_status_bar();
}

/********************************************************************
function: wolf_main_desktop_status_bar(void)
discript: display desktop status bar
entrance: none
return  : none
time    : 2014.9.6
other   : none
********************************************************************/
void wolf_main_desktop_status_bar(void)
{
	RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure);
	BACK_COLOR= BLUE;
	POINT_COLOR=BLACK;
	wolf_LCD9341_num(176, 303, RTC_TimeStructure.RTC_Hours, 2, 0);
	wolf_LCD9341_num(196, 303, RTC_TimeStructure.RTC_Minutes, 2, 0);
	wolf_LCD9341_num(216, 303, RTC_TimeStructure.RTC_Seconds, 2, 0);
	wolf_LCD9341_char(190,302,':',1);
	wolf_LCD9341_char(210,302,':',1);
}
